home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / amigae / gencodee_v22.lha / GenCodeE / sources / GenCodeE_v22 / Variable.e < prev   
Encoding:
Text File  |  1994-11-16  |  1.5 KB  |  70 lines

  1. OPT MODULE
  2. OPT EXPORT
  3.  
  4.  
  5. ->*****
  6. ->** External modules
  7. ->*****
  8. MODULE 'muibuilder' , 'libraries/muibuilder'
  9. MODULE 'utility/tagitem'
  10.  
  11.  
  12. ->*****
  13. ->** Exception handling
  14. ->*****
  15. RAISE    "MEM"    IF    String()    =    NIL
  16.  
  17.  
  18. ->*****
  19. ->** Object definitions
  20. ->*****
  21. OBJECT variable
  22.     ident    :    PTR TO CHAR
  23.     type    :    LONG
  24.     size    :    LONG
  25.     init    :    LONG
  26. ENDOBJECT
  27.  
  28.  
  29. /******************************************
  30. ** Returns an array of all the variables **
  31. ******************************************/
  32. PROC init_variables( number_vars )
  33.  
  34.     DEF vars : PTR TO variable , ident_length_max = 0
  35.     DEF ident : PTR TO CHAR , type , size , init
  36.     DEF i , tmp_ident : PTR TO CHAR
  37.  
  38.     NEW vars[ number_vars ]
  39.  
  40.     FOR i := 0 TO ( number_vars - 1 )
  41.  
  42.         Mb_GetVarInfoA( i ,
  43.                         [    MUIB_VARTYPE    , {type}    ,
  44.                             MUIB_VARNAME    , {ident}    ,
  45.                             MUIB_VARSIZE    , {size}    ,
  46.                             MUIB_VARINITPTR    , {init}    ,
  47.                             TAG_END ] )
  48.  
  49.         tmp_ident := String( StrLen( ident ) )
  50.         StrCopy( tmp_ident , ident )
  51.  
  52.         IF ( type <> TYPEVAR_HOOK ) AND ( type <> TYPEVAR_IDENT ) AND ( type <> TYPEVAR_EXTERNAL )
  53.  
  54.             IF ( tmp_ident[] >= "A" ) AND ( tmp_ident[] <= "Z" ) THEN tmp_ident[] :=  tmp_ident[] + 32
  55.             IF EstrLen( tmp_ident ) >= 2 THEN
  56.                 IF ( tmp_ident[ 1 ] >= "A" ) AND ( tmp_ident[ 1 ] <= "Z" ) THEN tmp_ident[ 1 ] :=  tmp_ident[ 1 ] + 32
  57.  
  58.         ENDIF
  59.  
  60.         vars[ i ].ident := tmp_ident
  61.         vars[ i ].type := type
  62.         vars[ i ].size := size
  63.         vars[ i ].init := init
  64.  
  65.         IF EstrLen( tmp_ident ) > ident_length_max THEN ident_length_max := EstrLen( tmp_ident )
  66.  
  67.     ENDFOR
  68.  
  69. ENDPROC vars , ident_length_max
  70.